package com.airforce.mappers;

import com.airforce.model.option;
import org.apache.ibatis.jdbc.SQL;

public class optionSqlProvider {

    public String insertSelective(option record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("option");
        
        if (record.getId() != null) {
            sql.VALUES("id", "#{id,jdbcType=INTEGER}");
        }
        
        if (record.getOptionid() != null) {
            sql.VALUES("optionID", "#{optionid,jdbcType=VARCHAR}");
        }
        
        if (record.getA() != null) {
            sql.VALUES("A", "#{a,jdbcType=VARCHAR}");
        }
        
        if (record.getB() != null) {
            sql.VALUES("B", "#{b,jdbcType=VARCHAR}");
        }
        
        if (record.getC() != null) {
            sql.VALUES("C", "#{c,jdbcType=VARCHAR}");
        }
        
        if (record.getD() != null) {
            sql.VALUES("D", "#{d,jdbcType=VARCHAR}");
        }
        
        if (record.getCreatetime() != null) {
            sql.VALUES("createtime", "#{createtime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getUpdatetime() != null) {
            sql.VALUES("updatetime", "#{updatetime,jdbcType=TIMESTAMP}");
        }
        
        return sql.toString();
    }

    public String updateByPrimaryKeySelective(option record) {
        SQL sql = new SQL();
        sql.UPDATE("option");
        
        if (record.getOptionid() != null) {
            sql.SET("optionID = #{optionid,jdbcType=VARCHAR}");
        }
        
        if (record.getA() != null) {
            sql.SET("A = #{a,jdbcType=VARCHAR}");
        }
        
        if (record.getB() != null) {
            sql.SET("B = #{b,jdbcType=VARCHAR}");
        }
        
        if (record.getC() != null) {
            sql.SET("C = #{c,jdbcType=VARCHAR}");
        }
        
        if (record.getD() != null) {
            sql.SET("D = #{d,jdbcType=VARCHAR}");
        }
        
        if (record.getCreatetime() != null) {
            sql.SET("createtime = #{createtime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getUpdatetime() != null) {
            sql.SET("updatetime = #{updatetime,jdbcType=TIMESTAMP}");
        }
        
        sql.WHERE("id = #{id,jdbcType=INTEGER}");
        
        return sql.toString();
    }
}